<?php

class Admin_Form_AddPrivilege extends Zend_Form
{

    public function init()
    {
        $roles = new Knihovna_Model_DbTable_Usersrole();
        $roleslist = $roles->fetchArray();
        $resources = new Knihovna_Model_DbTable_Usersresources();
        $resourceslist = $resources->fetchArray();

        $role = new Zend_Form_Element_Select ('role');
        $role->setLabel('Role');
        $role->setMultiOptions($roleslist);
        $resource = new Zend_Form_Element_Select ('resource');
        $resource->setLabel('Zdroj');
        $resource->setMultiOptions($resourceslist);

        $privilege = new Zend_Form_Element_Text('privilege');
        $privilege->setLabel("Oprávnění:");

        $send = new Zend_Form_Element_Submit('submit_add','Přidat');

        $role->addValidator('NotEmpty',true);
        $resource->addValidator('NotEmpty',true);
        $privilege->addValidator('NotEmpty',true);


        $privilege->addFilter('StringTrim');
        $privilege->addFilter('StripTags');

        $this->addElements(array($role, $resource, $privilege, $send));
    }


}

